﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TreeRenderingWithVisitor
{
    class Program
    {
        static void Main(string[] args)
        {
            var root = new Tree();
            root.Id = "1";
            root.Name = "Root";

            var node = new Tree { Id = "1_1", Name = "Node1_1" };
            var node2 = new Tree { Id = "2_1", Name = "Node2_1" };
            node.AddChild(node2);
            var node3 = new Tree { Id = "2_2", Name = "Node2_2" };
            node.AddChild(node3);

            root.AddChild(node);

            var node1_2 = new Tree { Id = "1_2", Name = "Node1_2" };
            root.AddChild(node1_2);

            var htmlTree = root.Render(new HtmlRenderer());
            Console.WriteLine(htmlTree);

            Console.WriteLine("------------");

            var xmlTree = root.Render(new XmlRenderer());
            Console.WriteLine(xmlTree);

            Console.ReadKey(); 
        }
    }
}
